/*
@author : SuoNi
@date : 2021/12/9 12:29
@Mail : suoni1919@gmail.com
@Description:
*/
package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	type Movie struct {
		Title  string
		Year   int  `json:"released"`
		Color  bool `json:"color,omitempty"`
		Actors []string
	}

	var movies = []Movie{
		{Title: "Casablanca", Year: 1942, Color: false,
			Actors: []string{"Humphrey Bogart", "Ingrid Bergman"}},
		{Title: "Cool Hand Luke", Year: 1967, Color: true,
			Actors: []string{"Paul Newman"}},
		{Title: "Bullitt", Year: 1968, Color: true,
			Actors: []string{"Steve McQueen", "Jacqueline Bisset"}},
		// ...
	}

	data, _ := json.MarshalIndent(movies, "", "	")
	fmt.Printf("%s", data)
	//fmt.Println(data)
}
